package com.anti.modular.sys.pos.dao.impl;

import com.anti.jdbc.DBUtils;
import com.anti.modular.sys.pos.dao.SysPosDao;
import com.anti.modular.sys.pos.entity.SysPos;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Description TODO
 * @Author anTi
 * @Date 2021-3-11
 */
@Service
public class SysPosDaoImpl implements SysPosDao {
    @Resource
    DBUtils dbUtils;

    @Override
    public void save(SysPos sysPos) {
        String sql="INSERT INTO sys_pos (name, code, sort, remark, status," +
                " create_time, create_user) VALUES (?,?,?,?,?,?,?)";
        dbUtils.execSql(sql,sysPos.getName(),sysPos.getCode(),sysPos.getSort(),sysPos.getRemark(),sysPos.getStatus(),sysPos.getCreateTime(),sysPos.getCreateUser());
    }

    @Override
    public void update(SysPos sysPos) {
        String sql="update sys_pos set name=?, code=?, sort=?, remark=?, update_time=?, update_user=? where id=?";
        dbUtils.execSql(sql,sysPos.getName(),sysPos.getCode(),sysPos.getSort(),sysPos.getRemark(),sysPos.getUpdateTime(),sysPos.getUpdateUser(),sysPos.getId());
    }


    @Override
    public void delete(Long id) {
        String sql="update sys_pos set status=2 where id=?";
        dbUtils.execSql(sql,id);
    }
}
